package ooboo.gui;

import java.awt.BorderLayout;
import java.awt.Frame;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;

import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JDialog;
import javax.swing.JLabel;

public class TwitPic extends JDialog {

	private URL location = null;
	private BufferedImage pic = null;
	
	public TwitPic (String url) {
		try {
			location = new URL (url.toLowerCase().replace("http://twitpic.com/", "http://twitpic.com/show/large/"));
		} catch (MalformedURLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		try {
			pic = ImageIO.read(location);
			
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		JLabel picPane = new JLabel(new ImageIcon(pic));
		getContentPane().setLayout(new BorderLayout());
		getContentPane().add(picPane);
		pack();
		setResizable(false);
		setLocationRelativeTo(null);
		setVisible(true);
	}

}
